
from fastapi import APIRouter
from FastApi_test.idcard_check import  User

# coding:utf-8






router=APIRouter(prefix="/test",tags=["测试"],responses={404:{"description":"Not found"}})
@router.post(path="/test_id")
def test(data:User):
    # idcard=data.idcard

    idcard=data.dict()["idcard"]
    print(idcard)


    # iii["idcard"]
    return {"key":"test",
            "value":idcard+'abc'}


#
# router = APIRouter(prefix="/corp_info", tags=["企业信息"])
# @router.post(path="/query_corp_info", summary="企业信息查询")
# def calc_query_corp_info(user: User):
#     """
#     企业名称
#     企业统一码
#     企业法人证件号
#     :param corp_code:
#     :return:
#     """
#     data=user.dict()
#     corp_code = data["corp_code"]
#     table_name="zxk_jsyh_zh_sjxxeq"
#     query=f"""
# 	select qymc as `单位名称`,tyshxydm as `统一社会信用代码`,qyfrzjhm as `企业法人证件号码` from {table_name} where tyshxydm='{corp_code}'
# 	"""
#     try:
#         res=pd.read_sql(query,conn_zxk).iloc[0]
#         return {
#             "key":"企业基本信息",
#             "value":res
#         }
#     except 	Exception as e:
#         return None

# @router.post(path="/environment_protection_level", summary="企业最新环保等级")
# def calc_query_corp_info(data=Body("corp_code")):
#     """
#     企业最新环保等级
#     :param corp_code:
#     :return:
#     """
#     # zxk_jsyh_zh_sjxxeq
#     corp_code = data["corp_code"]
#     table_name = "zxk_jsyh_zh_sjxxeq"
#     query = f"""
# 	select qyhbdj  from {table_name} where tyshxydm = '{corp_code}'
# 	"""
#     try:
#         res=pd.read_sql(query,conn_zxk).iloc[0]["qyhbdj"]
#         return {
#             "key":"企业最新环保等级",
#             "value":res
#         }
#     except 	Exception as e:
#         return None

